﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Modules.ascx.cs" Inherits="Member_Control_Modules" %>
<h2>
    Chức năng chương trình</h2>
<div style="margin-bottom: 15px">
    Nhóm module
    <asp:DropDownList ID="ddlModules" runat="server" AppendDataBoundItems="true" Width="250px">
        <asp:ListItem Value="">------------------ Chọn module -----------------</asp:ListItem>
    </asp:DropDownList>
    <span class="button fix">
        <asp:Button ID="btnUpdate" runat="server" Text="Cập nhật" 
        onclick="btnUpdate_Click" />
        <span></span></span>
</div>
<table class="grid alter">
    <tr>
        <th width="30">
        </th>
        <th>
            Chức năng
        </th>
        <th width="150px">
            Phòng ban
        </th>
        <th width="40px">
        </th>
    </tr>
    <asp:Repeater ID="rep" runat="server" onitemdatabound="rep_ItemDataBound">
        <ItemTemplate>
            <tr>
                <td align="center">
                    <%# Container.ItemIndex + 1 %>
                </td>
                <td>
                    <%# Eval("ModName") %>
                    <asp:HiddenField ID="hidModCode" runat="server" Value='<%# Eval("ModCode") %>' />
                </td>
                <td align="center">
                    <asp:DropDownList ID="ddlDepart" runat="server" AppendDataBoundItems="true" Width="120px"
                        DataSource="<%# tblDepart %>" DataTextField="DepartName" DataValueField="Id">
                        <asp:ListItem Value="00000000-0000-0000-0000-000000000000">Chọn phòng ban</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td align="center">
                    <asp:CheckBox ID="chkEnable" runat="server" Checked='<%# Eval("IsEnable") %>' />
                </td>
            </tr>
        </ItemTemplate>
    </asp:Repeater>
</table>
<script type="text/javascript">
    $(document).ready(function(){
        $("select[id*='ddlModules']").change(function(){
            var role = $.url.param('r');
            window.location = "/Member/Modules.aspx?m=" + $(this).val();
        });
        
        $(".chk").click(function(){
            var checked = $("input", $(this)).is(':checked');
            $('.chk-' + $(this).attr('index')).each(function(){
                $('input',$(this)).attr('checked', checked);
            });
        });
    });
</script>
